package com.changil.admin.action.board;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.changil.admin.action.Action;
import com.changil.admin.protocol.ArticleManager;
import com.changil.admin.protocol.http.HttpUtil;

public class DeleteAction extends Action {
	private int boardId;

	public DeleteAction(int boardId) {
		this.boardId = boardId;
	}

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		try{
			int articleId = Integer.parseInt(request.getParameter("articleId"));
			ArticleManager.getsInstance().deleteArticle(articleId);
			HttpUtil.redirect(response, "/NowonChangilChurch_Admin/board?boardId="+boardId);
			
		}catch(Exception e) {
			e.printStackTrace();
		}

	}

}
